{ Flags : }
{ Flag 1 is turned on when match is lit }
{ Flag 2 turned off when throne is pushed the first time }
{ Flag 3 used to indicate correct answer to desk question }
{ Flag 4 used if desk is open }
{ Flag 5 is used if "FORGE" command given only once }
{ Flag 6 turned off when Fafner dies }
{ Flag 7 turned off when lipstick is given up}
{ Flag 8 turned off when raven's warning is given }
{ Flag 9 is turned on when magic object is tried }
{ Flag 10 is turned on if conditions are met to open desk}
{ Variable 1 is number of matches remaining }
{ Variable 2 is number of turns match is lit - max 2 }
{ Variable 3 is number of turns wearing Tarnhelm }
{ Variable 4 is # of turns to give lipstick to Brunnhilde }
{ Variable 5 is temp variable - only can try to open desk twice}
{ Variable 6 hold number of object tried to open desk}
{ Noun 221 is unlit match }
{ Noun 222 is lit match }
{ Noun 223 is burnt out match }


COMMAND ANY
TurnsLT 2                    {at beginning of game}
TurnFlagOff 1                {set matches off}
SetVariableTo 1 5            {initialize # matches}
SetVariableTo 3 7            {# of safe turns to wear Tarnhelm}
SetVariableTo 5 0            {set temp desk open var. to 0}
TurnFlagOn 2                 {set throne flag on}
TurnFlagOff 4                {flag for desk open or closed}
TurnFlagOff 5                {flag for "FORGE" command not given}
TurnFlagOn 6                 {Fafner still lives}
TurnFlagOn 8                 {raven's message}
TurnFlagOff 9                {magic object not selected}
END_COMMAND

COMMAND ANY
FlagOn 1                     {match is lit}
SubtractFromVariable 2 1     {decrement match time}
END_COMMAND

COMMAND ANY
FlagOn 1                     {match is lit}
VariableEquals 2 0           {match life is ended}
PrintMessage 15              {match burns out}
TurnFlagOff 1                {reset match lit flag}
SwapLocations 222 223        {exchange lit match for burnt match}
DropIt 223                   {drop burnt match}
END_COMMAND

COMMAND ANY
IsWearing 217                {if player wearing Tarnhelm}
SubtractFromVariable 3 1     {decrement safe turns}
END_COMMAND

COMMAND ANY
IsWearing 217                {if player wearing Tarnhelm}
VariableEquals 3 3           {third turn wearing Tarnhelm}
PrintMessage 42              {starting to feel woozy}
END_COMMAND

COMMAND ANY
IsWearing 217                {if player wearing Tarnhelm}
VariableEquals 3 2           {fourth turn wearing Tarnhelm}
PrintMessage 43              {it gets worse}
END_COMMAND

COMMAND ANY
IsWearing 217                {if player wearing Tarnhelm}
VariableEquals 3 1           {last safe turn to wear helmet}
PrintMessage 44              {really bad}
END_COMMAND

COMMAND ANY
IsWearing 217                {if player wearing Tarnhelm}
VariableEquals 3 0           {time's up!}
PrintMessage 45              {player dies}
GoToRoom 31                  {opera and lose}
DoneWithTurn
END_COMMAND

COMMAND ANY
AtLocation 27                {Brunnhilde's Rock}
Present 315                  {Brunnhilde is awake}
FlagOn 7                     {no lipstick yet}
SubtractFromVariable 4 1     {decrement variable 4}
END_COMMAND

COMMAND ANY
AtLocation 27                {Brunnhilde's Rock}
Present 315                  {she's awake}
VariableEquals 4 1           {getting close}
PrintMessage 47              {she's getting impatient}
END_COMMAND

COMMAND ANY
AtLocation 27                {Brunnhilde's Rock}
Present 315                  {she's awake}
VariableEquals 4 0           {out of time}
PrintMessage 48              {she kicks player in balls}
RemoveFromGroup 315          {Brunnhilde drops player re:rock}
GoToRoom 31                  {end of the line}
DoneWithTurn
END_COMMAND

COMMAND ANY
FlagOn 8                     {test for message given}
FlagOff 6                    {Fafner is dead}
AtLocation 8                 {front porch}
Not IsCarrying 215           {player doesn't have bird speech}
PrintMessage 52              {ravens, but no speech}
WaitForReturn
TurnFlagOff 8                {flag that message is given}
END_COMMAND

COMMAND ANY
FlagOn 8                     {test for message given}
FlagOff 6                    {Fafner is dead}
AtLocation 8                 {front porch}
IsCarrying 215               {player has bird understanding}
PrintMessage 53              {raven's message}
WaitForReturn
TurnFlagOff 8                {flag that message is given}
END_COMMAND

COMMAND DEBUG
ToggleFlag 0                 {turns on/off debugging system}
DoneWithTurn
END_COMMAND


COMMAND INVENTORY
IsCarrying 220               {has matchbox}
IsOpen 220                   {matchbox is open}
VariableGT 1 1               {2 or more matches left}
ShowInventory                {first}
PrintMessage 54              {how many matches left}
DoneWithTurn
END_COMMAND

COMMAND INVENTORY
IsCarrying 220               {has matchbox}
IsOpen 220                   {matchbox is open}
VariableEquals 1 1           {one match left}
ShowInventory                {first}
PrintMessage 55              {one match left}
DoneWithTurn
END_COMMAND

COMMAND INVENTORY
IsCarrying 220               {has matchbox}
IsOpen 220                   {matchbox is open}
VariableEquals 1 0           {out of matches}
ShowInventory                {first}
PrintMessage 56              {out of matches}
DoneWithTurn
END_COMMAND

COMMAND REMOVE ANY
NounIsNumber 217             {removing tarnhelm}
PrintMessage 46              {you feel better}
RemoveIt 217                 {do it}
SetVariableTo 3 6            {reset counter}
DoneWithTurn
END_COMMAND

COMMAND EAST
Atlocation 26                {if mountain pass}
not Present 231              {player has no fear}
GoToRoom 27                  {makes it in}
PrintMessage 27              {message to that effect}
DoneWithTurn
END_COMMAND

COMMAND EAST
AtLocation 26                {if mountain pass}
Present 231                  {player has fear}
PrintMessage 28              {cannot go on}
DoneWithTurn
END_COMMAND

COMMAND FORGE PIECES
AtLocation 5                 {in Mimas' cave}
Present 206                  {can only forge metal shards}
Present 203                  {hot forge must be present}
FlagOff 5                    {player has not given command yet}
TurnFlagOn 5                 {turn flag on}
PrintMessage 1               {refuse first time}
DoneWithTurn
END_COMMAND

COMMAND FORGE PIECES
AtLocation 5                 {in Mimas' cave}
Present 206                  {can only forge metal shards}
Present 203                  {hot forge must be present}
FlagOn 5                     {second time command is given}
SwapLocations 206 204        {swap metal shards for sword}
SwapLocations 301 302        {swap benign dwarf for angry dwarf}
Destroy 206                  {dump the shards}
PrintMessage 2               {Ok, do it}
DoneWithTurn
END_COMMAND

COMMAND FORGE PIECES
AtLocation 5                 {in Mimas' cave}
Present 206                  {has metal pieces}
NOT Present 203              {forge is still cool}
PrintMessage 4               {forge is too cool to forge sword}
DoneWithTurn
END_COMMAND

COMMAND PUT COAL IN FORGE
AtLocation 5                 {must be in Mimas' cave}
Present 213                  {coal lumps}
SwapLocations 202 203        {swap cool forge for hot forge}
PrintMessage 5               {forge is now blazing hot}
Destroy 213                  {coal lumps all burned up}
DoneWithTurn
END_COMMAND

COMMAND PUT ANY IN HOLE
FlagOff 9                    {is flag already set?}
TurnFlagOff 10               {set temp flag off}
AtLocation 27                {Brunnhilde's Rock}
NounPresent                  {player has noun}
IsClosed 238                 {desk is still closed}
MakeVarNounNum 6             {set variable to correct noun #}
VariableGT 6 231             {test for variable in range 232-237}
VariableLT 6 238             {test for variable in range 232-237}
TurnFlagOn 10                {temp flag on}
END_COMMAND

COMMAND PUT ANY IN HOLE
FlagOff 9                    {desk is still closed}
FlagOn 10                    {conditions are met}
AddToVariable 5 1            {increment variable 5}
VariableLT 5 2               {two tries}
Chance 60                    {chance to succeed - fair shot}
TurnFlagOn 9                 {set success flag}
UnlockIt 238                 {unlock desk}
OpenIt 238                   {open desk}
Destroy 239                  {eliminate hole}
PutInCurrentRoom 314         {add sleeping Brunnhilde}
PrintMessage 57              {desk opens}
LookAtRoom                   {refresh player's memory}
DoneWithTurn
END_COMMAND

COMMAND PUT ANY IN HOLE
FlagOff 9                    {is flag already set?}
FlagOn 10                    {conditions are met, but no success}
VariableLT 5 2               {two tries}
PrintMessage 59              {failure message}
DoneWithTurn
END_COMMAND

COMMAND PUT ANY IN HOLE
FlagOff 9                    {is flag already set?}
AtLocation 27                {Brunnhilde's Rock}
NounPresent                  {player has noun}
IsClosed 238                 {desk is still closed}
VariableLT 5 2               {two tries only}
Not VariableGT 6 231         {test for variable in range 232-237}
  OR
Not VariableLT 6 238         {test for variable in range 232-237}
PrintMessage 62              {improper object}
DoneWithTurn
END_COMMAND

COMMAND PUT ANY IN HOLE
FlagOff 9                    {is flag already set?}
AtLocation 27                {Brunnhilde's Rock}
NounPresent                  {player has noun}
IsClosed 238                 {desk is still closed}
VariableEquals 5 2           {two tries only!}
PrintMessage 60              {oops}
WaitForReturn                {time to read clever prose}
GoToRoom 31                  {end of game at the opera}
DoneWithTurn
END_COMMAND

COMMAND PUT ANY IN HOLE
FlagOn 9                     {flag is already set}
PrintMessage 58
DoneWithTurn
END_COMMAND

COMMAND KILL ANY WITH ROCKS
NounIsNumber 304             {mutant Opera volunteer}
PrintMessage 50              {mutant Opera volunteer death scene}
Destroy 304                  {remove from game}
Destroy 211                  {get rid of rocks}
DoneWithTurn
END_COMMAND

COMMAND KILL DWARF WITH SWORD
AtLocation 5                 {in Mima's cave}
Present 204                  {sword must be present}
Present 302                  {hostile Mimas is here}
PrintMessage 51              {Mimas death scene}
Destroy 302                  {poor Mimas}
DoneWithTurn
END_COMMAND

COMMAND KILL DRAGON WITH SWORD
Present 305                  {Fafner!}
IsCarrying 204               {player has sword}
PrintMessage 8               {Fafner dies}
Destroy 305                  {thus Fafner dies}
Destroy 216                  {dwarves steal the treasure}
PutInCurrentRoom 214         {put the blood in the cave}
TurnFlagOff 6                {flag Fafner's death}
DoneWithTurn
END_COMMAND

COMMAND DRINK BLOOD
Present 214                  {player drinks blood}
SendToRoom 215 1             {give bird understanding to player}
Destroy 214                  {bye-bye blood}
PrintMessage 9               {OK - birds talk}
DoneWithTurn
END_COMMAND

COMMAND TALK TO COCKATOO
AtLocation 10                {in the stone cubicle}
Present 215                  {player can understand birds}
PrintMessage 10              {bird describes elevator}
DoneWithTurn
END_COMMAND

COMMAND TALK TO COCKATOO
AtLocation 10                {in the stone cubicle}
Not Present 215              {player can't understand birds}
PrintMessage 11              {bird squwaks}
DoneWithTurn
END_COMMAND

COMMAND TALK TO USHER
AtLocation 28                {Wagner's entryway}
PrintMessage 37              {usher patiently explains}
DoneWithTurn
END_COMMAND

COMMAND COCKATOO,ANY
ReDirectTo TALK TO COCKATOO
END_COMMAND

COMMAND COCKATOO,ANY
ReDirectTo TALK TO COCKATOO
END_COMMAND

COMMAND USHER,ANY
AtLocation 28                {Wagner's entryway}
PrintMessage 37              {usher patient explains}
DoneWithTurn
END_COMMAND

COMMAND LIGHT MATCHES
NounIsNumber 221             {waterproof matches}
IsCarrying 221               {must have them!}
FlagOff 1                    {match is not currently lit}
VariableGT 1 0               {player has some left}
SubtractFromVariable 1 1     {decrement # matches}
GetIt 222                    {burning match}
TurnFlagOn 1                 {set match flag on}
SetVariableTo 2 2            {set two turns for match life}
PrintMessage 14              {match is lit}
DoneWithTurn
END_COMMAND

COMMAND LIGHT MATCHES
NounIsNumber 221             {waterproof matches}
IsCarrying 221               {must have them!}
FlagOff 1                    {match is not currently lit}
VariableGT 1 0               {player has some left}
SubtractFromVariable 1 1     {decrement # matches}
VariableEquals 1 0           {out of matches}
Destroy 221                  {eliminate matches}
GetIt 222                    {burning match}
TurnFlagOn 1                 {set match flag on}
SetVariableTo 2 2            {set two turns for match life}
PrintMessage 14              {match is lit}
DoneWithTurn
END_COMMAND

COMMAND LIGHT MATCHES
VariableEquals 1 0           {out of matches}
PrintMessage 16              {Sorry, out of matches}
DoneWithTurn
END_COMMAND

COMMAND LIGHT PROGRAM
AtLocation 17                {in the sweatshop}
IsCarrying 209               {player has opera program}
IsCarrying 222               {player has burning match}
Destroy 209                  {opera program gone}
Destroy 310                  {monkey out}
PrintMessage 17              {message to that effect}
GoToRoom 21                  {switch to empty sweatshop}
DoneWithTurn
END_COMMAND

COMMAND LIGHT PROGRAM
Not AtLocation 17            {wrong room}
IsCarrying 209               {player has opera program}
IsCarrying 222               {player has burning match}
Destroy 209                  {opera program all burnt up}
PrintMessage 39              {program burns up}
DoneWithTurn
END_COMMAND

COMMAND LIGHT PROGRAM
Not IsCarrying 209           {player has no program}
PrintMessage 40              {can't do it}
DoneWithTurn
END_COMMAND

COMMAND LIGHT PROGRAM
Not IsCarrying 222           {no match lit}
PrintMessage 41              {can't do it}
DoneWithTurn
END_COMMAND

COMMAND PUSH THRONE
AtLocation 15                {south throne room}
FlagOn 2                     {is flag #2 on?}
TurnFlagOff 2                {if so turn it off}
QuitAllCMDs                  {stop meta command evaluation}
END_COMMAND

COMMAND PUSH THRONE
AtLocation 15                {south throne room}
FlagOff 2                    {is flag #2 off?}
IsLocated 310 17             {if the chimp still around}
GoToRoom 17                  {room with desk and chimp}
PrintMessage 38              {short version of message}
DoneWithTurn
END_COMMAND

COMMAND PUSH THRONE
AtLocation 15                {south throne room}
FlagOff 2                    {is flag #2 off?}
Not IsLocated 310 20         {chimp not around}
GoToRoom 21                  {room with desk}
PrintMessage 38              {short version of message}
DoneWithTurn
END_COMMAND

COMMAND PUSH BUTTON
AtLocation 21                {in sweat shop with desk}
NounIsNumber 229             {green button}
Present 204                  {if player has sword}
FlagOff 4                    {desk is not open}
TurnFlagOn 3                 {set answer flag}
PrintMessage 21              {instructions}
AskQuestion 1                {name of opera company on bag}
AnswerIsCorrect              {true if answer correct}
TurnFlagOff 3                {to mark answer as correct}
SwapLocations 224 225        {swap closed for open desk}
PrintMessage 18              {opening message}
TurnFlagOn 4                 {set desk flag to open position}
DoneWithTurn
END_COMMAND

COMMAND PUSH BUTTON
NounIsNumber 229             {green button}
FlagOff 4                    {desk is not open}
FlagOn 3                     {above answer was not correct}
Present 303                  {if Alberich is here}
Destroy 303                  {poor Alberich}
PrintMessage 19              {message}
TurnFlagOff 3
DoneWithTurn
END_COMMAND

COMMAND PUSH BUTTON
NounIsNumber 229             {green button}
FlagOff 4                    {desk is not open}
FlagOn 3                     {above answer was not correct}
Not Present 303              {Alberich already dead}
PrintMessage 20              {player bites the big one}
GoToRoom 31                  {end of the line}
TurnFlagOff 3                {Ok now}
DoneWithTurn
END_COMMAND

COMMAND PUSH BUTTON
AtLocation 21                {in sweat shop with desk}
NounIsNumber 229             {green button}
FlagOff 4                    {desk is not open}
TurnFlagOn 3                 {set answer flag}
PrintMessage 21              {instructions}
AskQuestion 2                {name of opera on program}
AnswerIsCorrect              {true if answer correct}
TurnFlagOff 3                {to mark answer as correct}
SwapLocations 224 225        {swap closed for open desk}
TurnFlagOn 4                 {set desk flag to open}
PrintMessage 18              {opening message}
DoneWithTurn
END_COMMAND

COMMAND PUSH BUTTON
NounIsNumber 229             {green button}
FlagOff 4                    {desk is not open}
FlagOn 3                     {above answer was not correct}
Present 303                  {if Alberich is here}
Destroy 303                  {poor Alberich}
PrintMessage 19              {message}
TurnFlagOff 3
DoneWithTurn
END_COMMAND

COMMAND PUSH BUTTON
NounIsNumber 229             {green button}
FlagOff 4                    {desk is not open}
FlagOn 3                     {above answer was not correct}
Not Present 303              {Alberich already dead}
PrintMessage 20              {player bites the big one}
GoToRoom 31                  {opera house}
TurnFlagOff 3                {Ok now}
DoneWithTurn
END_COMMAND

COMMAND PUSH BUTTON
AtLocation 21                {sweat shop}
FlagOn 4                     {desk is open}
PrintMessage 49              {desk is already open!]
DoneWithTurn
END_COMMAND

COMMAND GIVE MATCH TO ANY
AtLocation 23                {brick wall}
VariableGT 1 0               {player has matches}
GoToRoom 24                  {player to other side of wall}
PrintMessage 22              {gratitude!}
SubtractFromVariable 1 1     {another match out}
DoneWithTurn
END_COMMAND

COMMAND GIVE RING TO ANY
Present 227                  {player must have ring}
AtLocation 25                {on the riverbank}
ObjectIsNumber 312           {Rhinemaidens}
IsWearing 217                {tarnhelm}
Destroy 227                  {remove ring from game}
PrintMessage 23              {they take it}
PlusScore 100                {to maintain point total}
GoToRoom 26                  {to mountain pass}
DoneWithTurn
END_COMMAND

COMMAND GIVE RING TO ANY
Present 227                  {player must have ring}
AtLocation 25                {on the riverbank}
ObjectIsNumber 312           {Rhinemaidens}
Not IsWearing 217            {not wearing the tarnhelm}
PrintMessage 24              {take it and kill player}
GoToRoom 31                  {back to the opera}
DoneWithTurn
END_COMMAND

COMMAND GIVE RING TO ANY
Present 227                  {player must have ring}
Not AtLocation 25            {on the riverbank}
PrintMessage 25              {ring won't go}
DoneWithTurn
END_COMMAND

COMMAND GIVE TUBE TO ANY
AtLocation 27                {Brunnhilde's rock}
ObjectIsNumber 315           {awake Brunnhilde}
Present 207                  {lipstick}
TurnFlagOff 7                {set flag to "lipstick given"}
Destroy 207                  {au revoir, le lipstick}
PrintMessage 32              {nookies}
LookAtRoom                   {review whereabouts}
DoneWithTurn
END_COMMAND

COMMAND GIVE COUPON TO ANY
AtLocation 28                {Wagner's entryway}
Present 210                  {coupon}
Present 315                  {Brunnhilde}
ObjectIsNumber 316           {usher}
PrintMessage 34              {usher lets you in!}
SendToRoom 315 0             {get rid of Brunnhilde creature}
GoToRoom 29                  {where you win the game}
DoneWithTurn
END_COMMAND

COMMAND GIVE COUPON TO ANY
Not AtLocation 28            {not in the right place}
Present 210                  {coupon}
PrintMessage 35              {coupon blows away}
Destroy 210
DoneWithTurn
END_COMMAND

COMMAND GIVE COUPON TO ANY
AtLocation 28                {place is OK}
ObjectIsNumber 315           {Brunnhilde?}
PrintMessage 35              {coupon blows away}
Destroy 210                  {bye!}
DoneWithTurn
END_COMMAND

COMMAND GIVE COUPON TO ANY
Not Present 210              {player does not have coupon}
PrintMessage 36              {you don't have it!}
DoneWithTurn
END_COMMAND

COMMAND GIVE COUPON TO ANY
AtLocation 28                {place OK}
ObjectIsNumber 316           {usher}
Not Present 315              {no Brunnhilde}
PrintMessage 61              {sorry, no singles}
DoneWithTurn
END_COMMAND

COMMAND THROW RING TO ANY
ReDirectTo GIVE RING TO ANY
END_COMMAND

COMMAND THROW ROCKS AT ANY
ObjectIsNumber 304           {mutant Opera volunteer}
PrintMessage 50              {mutant Opera volunteer death scene}
Destroy 304                  {remove from game}
Destroy 211                  {get rid of rocks}
DoneWithTurn
END_COMMAND

COMMAND DROP FEAR
AtLocation 26                {only in mountain pass}
Present 204                  {player has the sword}
Present 217                  {player has the Tarnhelm}
Destroy 231                  {get rid of player's fear}
PrintMessage 26              {no more fear message}
DoneWithTurn
END_COMMAND

COMMAND DROP ALL
AtLocationLT 27              {before reaching Brunnhilde's Rock}
DropEverything               {first}
GetIt 231                    {fear returns}
DoneWithTurn
END_COMMAND

COMMAND DROP FEAR
AtLocation 26                {only in mountain pass}
Not Present 204
OR
Not Present 217              {either sword or tarnhelm missing}
PrintMessage 29              {no way to drop fear}
DoneWithTurn
END_COMMAND

COMMAND DROP FEAR
Not AtLocation 26            {not in mountain pass}
PrintMessage 33              {nope, sorry}
DoneWithTurn
END_COMMAND

COMMAND KISS ANY
AtLocation 27                {Brunnhilde's Rock}
Present 314                  {sleeping Brunnhilde}
SetVariableTo 4 3            {begins countdown for lipstick}
TurnFlagOn 7                 {set flag to "no lipstick"}
SwapLocations 314 315        {wake up, Brunnhilde!}
PrintMessage 30              {she's here!}
DoneWithTurn
END_COMMAND

COMMAND KISS ANY
AtLocation 27                {Brunnhilde's Rock}
Present 315                  {Brunnhilde awake}
PrintMessage 31              {enough kissing}
DoneWithTurn
END_COMMAND

